import com.zeng.dao.GetUser;
import com.zeng.dao.UserDao;
import com.zeng.dao.UserDaoMysqlimpl;
import com.zeng.dao.UserDaoOrcleimpl;
import com.zeng.service.UserServiceimpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author zeng
 * @data 2021/06/05 22:47
 */
public class Mytest {
    //private UserDao userDao;
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        UserServiceimpl service = (UserServiceimpl) context.getBean("userService1");
        service.getUser();

//        UserService userService = new UserServiceimpl();
//        userService.setUserDao(new UserDaoOrcleimpl());
//        userService.getUser();
//        int[] arr = new int[50];
//        int length = arr.length;
//        Random random = new Random();
//        for (int i = 0; i < length; i++) {
//            arr[i] = random.nextInt(11);
//        }
//        System.out.println(Arrays.toString(arr));

    }
    @Test
    public void JavaBeanDemo(){
        ApplicationContext Context = new AnnotationConfigApplicationContext(GetUser.class);
        UserDaoMysqlimpl userDao = Context.getBean("GetUserDao", UserDaoMysqlimpl.class);
        userDao.getUser();

    }
}

